//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package javax.vpncrypto;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.NetworkInterface;
import java.net.URL;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.AccessController;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.security.PublicKey;
import java.security.SignatureException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Random;
import java.util.jar.*;
import java.util.jar.Attributes.Name;
import javax.vpncrypto.CryptoPolicyParser.ParsingException;
import sun.security.validator.Validator;

final class JarVerifier {
    private static final String PLUGIN_IMPL_NAME = "sun.plugin.net.protocol.jar.CachedJarURLConnection";
    private static X509Certificate frameworkCertificate;
    private static Validator providerValidator;
    private static Validator exemptValidator;
    private List<X509Certificate> verifiedSignerCache = null;
    private URL jarURL;
    private Validator validator;
    private boolean savePerms;
    private javax.vpncrypto.CryptoPermissions appPerms = null;

    private static X509Certificate parseCertificate(String var0, CertificateFactory var1) throws Exception {
        ByteArrayInputStream var2 = new ByteArrayInputStream(var0.getBytes("UTF8"));
        return (X509Certificate)var1.generateCertificate(var2);
    }

    JarVerifier(URL var1, boolean var2) {
        this.jarURL = var1;
        this.savePerms = var2;
        this.validator = var2 ? providerValidator : exemptValidator;
        this.verifiedSignerCache = Collections.synchronizedList(new ArrayList(2));
    }

    void verify() throws JarException, IOException {
        if (this.jarURL == null) {
            throw new JarException("Class is on the bootclasspath");
        } else {
            try {
                this.verifyJars(this.jarURL, (List)null);
            } catch (NoSuchProviderException var7) {
                throw new JarException("Cannot verify " + this.jarURL.toString());
            } catch (CertificateException var8) {
                throw new JarException("Cannot verify " + this.jarURL.toString());
            } catch (ParsingException var9) {
                throw new JarException("Cannot parse " + this.jarURL.toString());
            } finally {
                if (this.verifiedSignerCache != null) {
                    this.verifiedSignerCache.clear();
                }

            }

        }
    }

    static void verifyPolicySigned(Certificate[] var0) throws Exception {
        List var1 = convertCertsToChains(var0);
        boolean var2 = false;
        Iterator var3 = var1.iterator();

        while(var3.hasNext()) {
            X509Certificate[] var4 = (X509Certificate[])var3.next();
            X509Certificate var5 = var4[0];
            if (var5.equals(frameworkCertificate)) {
                var2 = true;
                break;
            }
        }

        if (!var2) {
            throw new SecurityException("The jurisdiction policy files are not signed by the expected signer! (Policy files are specific per major JDK release.Ensure the correct version is installed.)");
        }
    }

    javax.vpncrypto.CryptoPermissions getPermissions() {
        return this.appPerms;
    }

    private void verifyJars(URL var1, List<String> var2) throws NoSuchProviderException, CertificateException, IOException, ParsingException {
        String var3 = var1.toString();
        if (var2 == null || !var2.contains(var3)) {
            String var4 = this.verifySingleJar(var1);
            if (var2 != null) {
                var2.add(var3);
            }

            if (var4 != null) {
                if (var2 == null) {
                    var2 = Collections.synchronizedList(new ArrayList());
                    var2.add(var3);
                }

                this.verifyManifestClassPathJars(var1, var4, var2);
            }
        }

    }

    private void verifyManifestClassPathJars(URL var1, String var2, List<String> var3) throws NoSuchProviderException, CertificateException, IOException, ParsingException {
        String[] var4 = parseAttrClasspath(var2);

        try {
            for(int var5 = 0; var5 < var4.length; ++var5) {
                URL var8 = new URL(var1, var4[var5]);
                this.verifyJars(var8, var3);
            }

        } catch (MalformedURLException var7) {
            MalformedURLException var6 = new MalformedURLException("The JAR file " + var1.toString() + " contains invalid URLs in its Class-Path attribute");
            var6.initCause(var7);
            throw var6;
        }
    }

    /**
     * todo: 这个函数反编译之后的结果很奇怪，返回的是一个jarfile类型，而不是string类型
     *  考虑到有可能用不到这个函数，随便给一个返回值吧。
     * @param var1
     * @return
     * @throws NoSuchProviderException
     * @throws CertificateException
     * @throws IOException
     * @throws ParsingException
     */
    private String verifySingleJar(URL var1) throws NoSuchProviderException, CertificateException, IOException, ParsingException {
        final URL var2 = var1.getProtocol().equalsIgnoreCase("jar") ? var1 : new URL("jar:" + var1.toString() + "!/");
        JarVerifier.JarHolder var3 = null;

        JarFile var4;
        try {
            try {
                var3 = (JarVerifier.JarHolder)AccessController.doPrivileged(new PrivilegedExceptionAction<JarVerifier.JarHolder>() {
                    public JarVerifier.JarHolder run() throws Exception {
                        boolean var1 = false;
                        JarURLConnection var2x = (JarURLConnection)var2.openConnection();
                        if (var2x.getClass().getName().equals("sun.plugin.net.protocol.jar.CachedJarURLConnection")) {
                            var1 = true;
                        }

                        var2x.setUseCaches(var1);
                        JarFile var3 = var2x.getJarFile();
                        return var3 != null ? new JarVerifier.JarHolder(var3, var1) : null;
                    }
                });
            } catch (PrivilegedActionException var28) {
                SecurityException var5 = new SecurityException("Cannot verify " + var2.toString());
                var5.initCause(var28);
                throw var5;
            }

            if (var3 != null) {
                var4 = var3.file;
                byte[] var32 = new byte[8192];
                Enumeration var6 = var4.entries();

                while(var6.hasMoreElements()) {
                    JarEntry var7 = (JarEntry)var6.nextElement();
                    BufferedInputStream var8 = new BufferedInputStream(var4.getInputStream(var7));
                    Throwable var9 = null;

                    try {
                        while(true) {
                            if (var8.read(var32, 0, var32.length) != -1) {
                                continue;
                            }
                        }
                    } catch (Throwable var29) {
                        var9 = var29;
                        throw var29;
                    } finally {
                        if (var8 != null) {
                            if (var9 != null) {
                                try {
                                    var8.close();
                                } catch (Throwable var27) {
                                    var9.addSuppressed(var27);
                                }
                            } else {
                                var8.close();
                            }
                        }

                    }
                }

                Manifest var33 = var4.getManifest();
                if (var33 == null) {
                    throw new JarException(var1.toString() + " is not signed.");
                }

                Enumeration var34 = var4.entries();

                while(true) {
                    while(true) {
                        JarEntry var35;
                        do {
                            if (!var34.hasMoreElements()) {
                                if (this.jarURL.equals(var1) && this.savePerms) {
                                    var35 = var3.file.getJarEntry("cryptoPerms");
                                    if (var35 == null) {
                                        throw new JarException("Can not find cryptoPerms");
                                    }

                                    this.appPerms = new javax.vpncrypto.CryptoPermissions();
                                    this.appPerms.load(var3.file.getInputStream(var35));
                                }

                                String var36 = var33.getMainAttributes().getValue(Name.CLASS_PATH);
                                return var36;
                            }

                            var35 = (JarEntry)var34.nextElement();
                        } while(var35.isDirectory());

                        Certificate[] var10 = var35.getCertificates();
                        if (var10 != null && var10.length != 0) {
                            int var11 = 0;
                            boolean var13 = false;

                            while(true) {
                                X509Certificate[] var12;
                                if ((var12 = getAChain(var10, var11)) != null) {
                                    if (this.verifiedSignerCache.contains(var12[0])) {
                                        var13 = true;
                                    } else {
                                        if (!this.isTrusted(var12)) {
                                            var11 += var12.length;
                                            continue;
                                        }

                                        var13 = true;
                                        this.verifiedSignerCache.add(var12[0]);
                                    }
                                }

                                if (!var13) {
                                    throw new JarException(var1.toString() + " is not signed by a trusted signer.");
                                }
                                break;
                            }
                        } else if (!var35.getName().startsWith("META-INF")) {
                            throw new JarException(var1.toString() + " has unsigned entries - " + var35.getName());
                        }
                    }
                }
            }

            var4 = null;
        } finally {
            if (var3 != null && !var3.useCaches) {
                var3.file.close();
            }

        }

        return var4.getName();
    }


    private static String[] parseAttrClasspath(String var0) throws JarException {
        var0 = var0.trim();
        int var1 = var0.indexOf(32);
        String var2 = null;
        ArrayList var3 = new ArrayList();
        boolean var4 = false;

        do {
            if (var1 > 0) {
                var2 = var0.substring(0, var1);
                var0 = var0.substring(var1 + 1).trim();
                var1 = var0.indexOf(32);
            } else {
                var2 = var0;
                var4 = true;
            }

            if (!var2.endsWith(".jar")) {
                throw new JarException("The provider contains un-verifiable components");
            }

            var3.add(var2);
        } while(!var4);

        return (String[])var3.toArray(new String[0]);
    }

    private boolean isTrusted(X509Certificate[] var1) {
        try {
            this.validator.validate(var1);
            return true;
        } catch (CertificateException var3) {
            return false;
        }
    }

    private static X509Certificate[] getAChain(Certificate[] var0, int var1) {
        if (var1 > var0.length - 1) {
            return null;
        } else {
            int var2;
            for(var2 = var1; var2 < var0.length - 1 && ((X509Certificate)var0[var2 + 1]).getSubjectDN().equals(((X509Certificate)var0[var2]).getIssuerDN()); ++var2) {
            }

            int var3 = var2 - var1 + 1;
            X509Certificate[] var4 = new X509Certificate[var3];

            for(int var5 = 0; var5 < var3; ++var5) {
                var4[var5] = (X509Certificate)var0[var1 + var5];
            }

            return var4;
        }
    }

    private static List<X509Certificate[]> convertCertsToChains(Certificate[] var0) throws CertificateException {
        if (var0 == null) {
            return Collections.emptyList();
        } else {
            ArrayList var1 = new ArrayList();
            X509Certificate[] var2 = null;

            for(int var3 = 0; (var2 = getAChain(var0, var3)) != null; var3 += var2.length) {
                var1.add(var2);
            }

            return var1;
        }
    }

    private static void testSignatures(X509Certificate var0, CertificateFactory var1) throws Exception {
        String var2 = "-----BEGIN CERTIFICATE-----\nMIIDLDCCAukCBDf5OeUwCwYHKoZIzjgEAwUAMHsxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTESMBAGA1UEBxMJQ3VwZXJ0aW5vMRkwFwYDVQQKExBTdW4gTWljcm9zeXN0ZW1zMRYwFAYDVQQLEw1KYXZhIFNvZnR3YXJlMRgwFgYDVQQDEw9KQ0UgRGV2ZWxvcG1lbnQwHhcNOTkxMDA0MjMzNjA1WhcNMDAxMDAzMjMzNjA1WjB7MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEjAQBgNVBAcTCUN1cGVydGlubzEZMBcGA1UEChMQU3VuIE1pY3Jvc3lzdGVtczEWMBQGA1UECxMNSmF2YSBTb2Z0d2FyZTEYMBYGA1UEAxMPSkNFIERldmVsb3BtZW50MIIBuDCCASwGByqGSM44BAEwggEfAoGBAP1/U4EddRIpUt9KnC7s5Of2EbdSPO9EAMMeP4C2USZpRV1AIlH7WT2NWPq/xfW6MPbLm1Vs14E7gB00b/JmYLdrmVClpJ+f6AR7ECLCT7up1/63xhv4O1fnxqimFQ8E+4P208UewwI1VBNaFpEy9nXzrith1yrv8iIDGZ3RSAHHAhUAl2BQjxUjC8yykrmCouuEC/BYHPUCgYEA9+GghdabPd7LvKtcNrhXuXmUr7v6OuqC+VdMCz0HgmdRWVeOutRZT+ZxBxCBgLRJFnEj6EwoFhO3zwkyjMim4TwWeotUfI0o4KOuHiuzpnWRbqN/C/ohNWLx+2J6ASQ7zKTxvqhRkImog9/hWuWfBpKLZl6Ae1UlZAFMO/7PSSoDgYUAAoGBAOGsR8waR5aiuOk1yBLemRlVCY+APJv3xqmPRxWAF6nwV2xrFUB8ghSEMFcHywoe4vBDvkGSoAFzeB5jy5wjDiFsN5AFPEVRfveS4NNZ1dgRdHbbh3h5O1dZE4MAKQwQfUoh9Oa3aahlB+orRzKOHLlGDpbNRQLST5BClvohramCMAsGByqGSM44BAMFAAMwADAtAhRF46T3nS+inP9TA1pLd3LIV0NNDQIVAIafi+1/+JKxu0rcoXWMFSxNaRb3\n-----END CERTIFICATE-----";
        byte[] var6 = getSystemEntropy();
        int var7 = var6[0] & 255 | (var6[1] & 255) << 8 | (var6[2] & 255) << 16 | var6[3] << 24;
        X509Certificate[] var8 = new X509Certificate[]{var0, parseCertificate(var2, var1), parseCertificate("-----BEGIN CERTIFICATE-----\nMIIB4DCCAYoCAQEwDQYJKoZIhvcNAQEEBQAwezELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlDdXBlcnRpbm8xGTAXBgNVBAoTEFN1biBNaWNyb3N5c3RlbXMxFjAUBgNVBAsTDUphdmEgU29mdHdhcmUxGDAWBgNVBAMTD0pDRSBEZXZlbG9wbWVudDAeFw0wMjEwMzExNTI3NDRaFw0wNzEwMzExNTI3NDRaMHsxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTESMBAGA1UEBxMJQ3VwZXJ0aW5vMRkwFwYDVQQKExBTdW4gTWljcm9zeXN0ZW1zMRYwFAYDVQQLEw1KYXZhIFNvZnR3YXJlMRgwFgYDVQQDEw9KQ0UgRGV2ZWxvcG1lbnQwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAo/4CddEOa3M6v9JFAhnBYgTq54Y30++F8yzCK9EeYaG3AzvzZqNshDy579647p0cOM/4VO6rU2PgbzgKXPcs8wIDAQABMA0GCSqGSIb3DQEBBAUAA0EACqPlFmVdKdYSCTNltXKQnBqss9GNjbnB+CitvWrwN+oOK8qQpvV+5LB6LruvRy6zCedCV95Z2kXKg/Fnj0gvsg==\n-----END CERTIFICATE-----", var1), parseCertificate("-----BEGIN CERTIFICATE-----\nMIIB4DCCAYoCAQIwDQYJKoZIhvcNAQEEBQAwezELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlDdXBlcnRpbm8xGTAXBgNVBAoTEFN1biBNaWNyb3N5c3RlbXMxFjAUBgNVBAsTDUphdmEgU29mdHdhcmUxGDAWBgNVBAMTD0pDRSBEZXZlbG9wbWVudDAeFw0wMjEwMzExNTI3NDRaFw0wNzEwMzExNTI3NDRaMHsxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTESMBAGA1UEBxMJQ3VwZXJ0aW5vMRkwFwYDVQQKExBTdW4gTWljcm9zeXN0ZW1zMRYwFAYDVQQLEw1KYXZhIFNvZnR3YXJlMRgwFgYDVQQDEw9KQ0UgRGV2ZWxvcG1lbnQwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAr1OSXaOzpnVoqL2LqS5+HLy1kVvBwiM/E5iYT9eZaghE8qvF+4fETipWUNTWCQzHR4cDJGJOl9Nm77tELhES4QIDAQABMA0GCSqGSIb3DQEBBAUAA0EAL+WcVFyj+iXlEVNVQbNOOUlWmlmXGiNKKXnIdNcc1ZUyi+JW0zmlfZ7iU/eRYhEEJBwdrUoyiGOGLo7pi6JzAA==\n-----END CERTIFICATE-----", var1)};
        PublicKey[] var9 = new PublicKey[4];
        var9[0] = var0.getPublicKey();
        var9[1] = var9[0];
        var9[2] = var8[2].getPublicKey();
        var9[3] = var9[2];
        boolean[] var10 = new boolean[]{true, false, true, false};

        for(int var11 = 0; var11 < 12; ++var11) {
            int var12 = var7 & 3;
            var7 >>= 2;

            boolean var13;
            try {
                var8[var12].verify(var9[var12]);
                var13 = true;
            } catch (SignatureException var15) {
                var13 = false;
            } catch (InvalidKeyException var16) {
                var13 = false;
            }

            if (var13 != var10[var12]) {
                throw new SecurityException("Signature classes have been tampered with");
            }
        }

    }

    private static byte[] getSystemEntropy() {
        MessageDigest var0;
        try {
            var0 = MessageDigest.getInstance("SHA");
        } catch (NoSuchAlgorithmException var19) {
            throw new InternalError("internal error: SHA-1 not available.", var19);
        }

        byte var1 = (byte)((int)System.currentTimeMillis());
        var0.update(var1);

        try {
            Properties var2 = System.getProperties();
            Iterator var3 = var2.stringPropertyNames().iterator();

            while(var3.hasNext()) {
                String var4 = (String)var3.next();
                var0.update(var4.getBytes());
                var0.update(var2.getProperty(var4).getBytes());
            }

            addNetworkAdapterInfo(var0);
            File var24 = new File(var2.getProperty("java.io.tmpdir"));
            int var26 = 0;
            DirectoryStream var5 = Files.newDirectoryStream(var24.toPath());
            Throwable var6 = null;

            try {
                Random var7 = new Random();
                Iterator var8 = var5.iterator();

                while(var8.hasNext()) {
                    Path var9 = (Path)var8.next();
                    if (var26 < 512 || var7.nextBoolean()) {
                        var0.update(var9.getFileName().toString().getBytes());
                    }

                    if (var26++ > 1024) {
                        break;
                    }
                }
            } catch (Throwable var20) {
                var6 = var20;
                throw var20;
            } finally {
                if (var5 != null) {
                    if (var6 != null) {
                        try {
                            var5.close();
                        } catch (Throwable var18) {
                            var6.addSuppressed(var18);
                        }
                    } else {
                        var5.close();
                    }
                }

            }
        } catch (Exception var22) {
            var0.update((byte)var22.hashCode());
        }

        Runtime var23 = Runtime.getRuntime();
        byte[] var25 = longToByteArray(var23.totalMemory());
        var0.update(var25, 0, var25.length);
        var25 = longToByteArray(var23.freeMemory());
        var0.update(var25, 0, var25.length);
        return var0.digest();
    }

    private static byte[] longToByteArray(long var0) {
        byte[] var2 = new byte[8];

        for(int var3 = 0; var3 < 8; ++var3) {
            var2[var3] = (byte)((int)var0);
            var0 >>= 8;
        }

        return var2;
    }

    private static void addNetworkAdapterInfo(MessageDigest var0) {
        try {
            Enumeration var1 = NetworkInterface.getNetworkInterfaces();

            while(var1.hasMoreElements()) {
                NetworkInterface var2 = (NetworkInterface)var1.nextElement();
                var0.update(var2.toString().getBytes());
                if (!var2.isVirtual()) {
                    byte[] var3 = var2.getHardwareAddress();
                    if (var3 != null) {
                        var0.update(var3);
                        break;
                    }
                }
            }
        } catch (Exception var4) {
        }

    }

    static {
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
                public Void run() throws Exception {
                    CertificateFactory var1 = CertificateFactory.getInstance("X.509");
                    JarVerifier.frameworkCertificate = JarVerifier.parseCertificate("-----BEGIN CERTIFICATE-----\nMIIDqDCCApCgAwIBAgIIfc4QiFTOxSQwDQYJKoZIhvcNAQELBQAwYDEbMBkGA1UECgwST3JhY2xlIENvcnBvcmF0aW9uMSMwIQYDVQQLDBpKYXZhIFNvZnR3YXJlIENvZGUgU2lnbmluZzEcMBoGA1UEAwwTSkNFIENvZGUgU2lnbmluZyBDQTAeFw0yMDAxMjkwMTMzMTRaFw0zMDEyMjkwMDAwMDBaMF8xGzAZBgNVBAoMEk9yYWNsZSBDb3Jwb3JhdGlvbjEjMCEGA1UECwwaSmF2YSBTb2Z0d2FyZSBDb2RlIFNpZ25pbmcxGzAZBgNVBAMMEk9yYWNsZSBDb3Jwb3JhdGlvbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJLjN4HTryTzmogEPAyBqzgHwiE17RTYJFmLn1EtgnnGxUzJUkdCTUDYYW6zojMLPxtTTcVL+8JA0636LwzAMJxViyBjzI5EikZJcMAuZv3PvmQwyFLa1JnZSQOCiaYMC5bROlefYOKwRaRWDtqfjw03e8O4gKZ6LYQDKdtwwWmHwlh9K1mYDDjNQcLCpiEHDLIHBRN4lK6KqN+w9cOwxLFJGnfOJoFfgVd5/BcBJRMJ325m8dgcDqZXL6BIT8vR0YP5RTVAxZF1HkbUt0L+jRFTbsI0REckAImPIMLmjQUHWZPDn/rgwUyZJoi1Ayg6eIDYjUdgbR+nbQ+xx2IAKR8CAwEAAaNnMGUwHQYDVR0OBBYEFFxpsLP0DowEMgBut24sVDK0NspCMB8GA1UdIwQYMBaAFFnVAYTTAjuNQZdGl+elUQe8bCArMA4GA1UdDwEB/wQEAwIHgDATBgNVHSUEDDAKBggrBgEFBQcDAzANBgkqhkiG9w0BAQsFAAOCAQEAAPbv1PgWBWLFZ0skpVmHkHF4rTIOowanrZMru1650T/e9ojBeCLdutJLPzMntXFUZHYudb909qV/nsPWm3RUkQxF+9/lJS6G2fs1utlFEf707rRp8BiRX3MtUTxo4ss7epZp9pVGmqxtEvURJ6z7o80c6SDkaFhdxTN85HBrxRxvEEY7rwVfbHV+xtEBp1EeofRkYvhVjPz41m7A4i+ERnL5EYoI2mZLGi5E/4WCw7VqDTV1q76nbz4L+50UItLe9pRUTv3v5gg4Hq2jdXxw/9CeqP4s60GzMn72DwZ+enwP4/yDe3D67u4+QRIOqJirxN49Ott5zbeDJdd7/7hZPg==\n-----END CERTIFICATE-----", var1);
                    X509Certificate[] var2 = new X509Certificate[]{JarVerifier.parseCertificate("-----BEGIN CERTIFICATE-----\nMIIDwDCCA36gAwIBAgIBEDALBgcqhkjOOAQDBQAwgZAxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTESMBAGA1UEBxMJUGFsbyBBbHRvMR0wGwYDVQQKExRTdW4gTWljcm9zeXN0ZW1zIEluYzEjMCEGA1UECxMaSmF2YSBTb2Z0d2FyZSBDb2RlIFNpZ25pbmcxHDAaBgNVBAMTE0pDRSBDb2RlIFNpZ25pbmcgQ0EwHhcNMDEwNDI1MDcwMDAwWhcNMjAwNDI1MDcwMDAwWjCBkDELMAkGA1UEBhMCVVMxCzAJBgNV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yz2nuUB3bb1EA1o0Uiayv/zuTGLjjoa1wtTx5G+4ig6V+ahl/V6bGTT6dhoDeVMUApbltPKJ8ebSYNRoZHbjkIegN1mJA9hE+Opft2P9raT/MJJxjdVGP/d6pLBQUu/tQ7/8fsEItFzSjFEOUwsXD9kw8zTVOFigo36ZDtMuMMHas+FtqvjEAHUN5WicO2HweUFNOyiZoJkGdycW/VXBF91e1Fbgxb3naPbZ/OUivlUToFjICSLDlq8TxEaNhIQ7B1JxwxnW3vWorRmFelMg4aQNawA==\n-----END CERTIFICATE-----", var1), JarVerifier.frameworkCertificate};
                    JarVerifier.providerValidator = Validator.getInstance("Simple", "jce signing", Arrays.asList(var2));
                    JarVerifier.exemptValidator = JarVerifier.providerValidator;
                    JarVerifier.testSignatures(var2[0], var1);
                    return null;
                }
            });
        } catch (Exception var6) {
            SecurityException var5 = new SecurityException("Framework jar verification can not be initialized");
            var5.initCause(var6);
            throw var5;
        }
    }

    private static class JarHolder {
        JarFile file;
        boolean useCaches;

        JarHolder(JarFile var1, boolean var2) {
            this.file = var1;
            this.useCaches = var2;
        }
    }
}
